$(document).ready(function () {
	
	$('#gethtml').click(function(){
		$('#quotes').load('quotes.php?list=authors&format=pretty')
        });

	$('#button_hreinsa_divs').click(function(){
		$('#quotes').empty();
        });

	$.getJSON('quotes.php?list=authors', function(data){
		$.each(data, function(value, key) {
		        $('#select').append('<option value="'+value+'">'+key+'</option>')
		    });
	});	
	
	$('#select').change(function() {
		$('#quotes').empty();
		$.getJSON('quotes.php?author='+$("#select option:selected").text(), function(data){
				$.each(data, function(value, key) {
				$('#quotes').append('<p>'+key+'</p>')
			});
		});
	});	
});